package com.tuling.mall.controller;

import com.alibaba.nacos.api.config.ConfigChangeEvent;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 放问的是配置文件是 mall-provide-order-dev.yml
 * 访问接口是 http://localhost:8023/index
 * 当配置改了之后接口任然是之前的值，需要加 @RefreshScope  //动态感知修改后的值
 */
@RefreshScope
@RestController
public class IndexController {

    @Value("${common.age}")
    private String age;
    @Value("${common.name}")
    private String name;

    @GetMapping("/index")
    public String hello() {
        return name+","+age;
    }
    
    
    
}
